package com.jackiechancinema.ssm.controller;

import com.jackiechancinema.ssm.bo.DreamBo;
import com.jackiechancinema.ssm.entity.Dreams;
import com.jackiechancinema.ssm.service.Inte.DreamService;
import com.jackiechancinema.ssm.vo.PageVo;
import com.jackiechancinema.ssm.vo.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/dream")
public class DreamController {
    @Autowired
    private DreamService dreamService;

    //查询所有
    @RequestMapping("/find")
    public PageVo<Dreams> find(DreamBo bo){


//        return dreamService.findAllV2(bo);
        PageVo<Dreams> allV2 = dreamService.findAllV2(bo);
        System.out.println(allV2);
        return allV2;

    }

    //添加
    @RequestMapping("/add")
    public R DreamAdd(Dreams dreams){

        return dreamService.insertAdd(dreams);
    }

    //修改
    @RequestMapping("/update")
    public R DreamUpdate(Dreams dreams){
//        Movices movices1 = new Movices(1,"123","123","123");
        return dreamService.updateUpdate(dreams);
    }

    //根据ID删除
    @RequestMapping("/del")
    public R DreamDel(int id){
        return dreamService.deleteDel(id);
    }
}
